package com.future.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("comment")
public class Comment {
    @TableId(type = IdType.AUTO)
    @ApiModelProperty("评论ID")
    private Long id;

    @ApiModelProperty("目标ID（可以是文章、视频等）")
    private Long targetId;

    @ApiModelProperty("目标类型（1=文章，3=媒体资源）")
    private Integer targetType;

    @ApiModelProperty("父评论ID（0为顶级）")
    private Long parentId;

    @ApiModelProperty("评论者ID")
    private Long userId;

    @ApiModelProperty("评论内容")
    private String content;
    @ApiModelProperty("点赞数")
    private Long likeCount;

    @ApiModelProperty("创建时间")
    private LocalDateTime createdAt;

    // 子评论列表，不映射到数据库
    @JsonIgnore
    @ApiModelProperty(hidden = true)
    //非数据库字段
    @TableField(exist=false)
    private List<Comment> children;
}